package com.jsbs.iam.ident.feign;

import com.github.pagehelper.PageInfo;
import com.jsbs.iam.common.core.dto.Result;
import com.jsbs.iam.ident.dto.*;
import com.jsbs.iam.ident.param.IamQueryUserByOrgParam;
import com.jsbs.iam.ident.param.IamUserInfoParam;
import com.jsbs.iam.ident.param.UserQueryParam;
import com.jsbs.iam.ident.param.UserQueryResp;
import com.jsbs.iam.ident.vo.AdminRoleVo;
import com.jsbs.iam.ident.vo.IamUserInfoVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @ClassName: IdentFeign
 * @Author: tenghuawei
 * @Date: 2022/12/14 10:46
 * @Description: openfeign调用上游服务接口
 */

@FeignClient(value = "iam-user",url = "${iam.user.domain:127.0.0.1:81}")
public interface IdentFeignInter {

        /**
         * 功能描述：根据名称/用户编码/手机号模糊搜索用户(开通+未开通的用户)
         * @param userQueryParam
         * @return
         */
        @PostMapping(value = "/iam/user/info/queryUserNotOpen", consumes = "application/json")
        Result<PageInfo<UserQueryResp>> queryUserNotOpen(UserQueryParam userQueryParam);

        /**
         * 功能描述：根据用户编码（usercode工号）,开通账号
         * @param userCode
         * @return Result
         */
        @PostMapping(value = "/iam/user/info/openAccount", consumes = "application/json")
        Result openAccount(List<String> userCode);

        /**
         * 功能描述：根据用户id批量删除账号(物理删除，删除按钮也可复用该接口)
         * @param userCode
         * @return Result
         */
        @PostMapping(value = "/iam/user/info/batchDeleteByUserCode", consumes = "application/json")
        Result batchDeleteByUserCode(List<String> userCode);

        /**
         * 功能描述：根据手机+组织类型编码+租户编码，查询用户中心是否有该用户
         * @param iamUserInfoParam
         * @return
         */
        @PostMapping(value = "/iam/user/info/getUserInfoByAny", consumes = "application/json")
        Result<IamUserInfoVo> getUserInfoByAny(IamUserInfoParam iamUserInfoParam);

        /**
         * 功能描述：根据用户id,获取应用列表
         * @param userCode
         * @return
         */
        @PostMapping(value = "/iam/user/Apply/getApplySystem", consumes = "application/json")
        Result getApplySystem(@RequestBody String userCode);

        /**
         * 功能描述：根据serverName获取应用
         * @param serverName
         * @return
         */
        @PostMapping(value = "/iam/user/apply/system/getApplySystem", consumes = "application/json")
        Result getApplySystemByUrl(String serverName);
        /**
         * 登录策略分页查询
         * @param iamIdentApplyDto
         * @return
         */
        @PostMapping(value = "/iam/user/Apply/getIamApplyPage", consumes = "application/json")
        Result getIamApplyPage(@RequestBody IamIdentApplyDto iamIdentApplyDto);

        /**
         * 获取应用列表
         * @param
         * @return
         */
        @PostMapping(value = "/iam/user/Apply/getApplySystemAll",consumes = "application/json")
        Result getApplySystemAll();

        /**
         * 根据应用系统名称获取应用系统编码
         * @param iamApplySystemDto
         * @param
         * @return
         */
        @PostMapping(value = "/iam/user/Apply/getApplyTypeCode",consumes = "application/json")
        Result getApplyTypeCode (@RequestBody IamIdentApplySystemDto iamApplySystemDto);

        /**
         * 根据应用类型查询用用名称
         * @param iamApplySystemDto
         * @param
         * @return
         */
        @PostMapping(value = "/iam/user/Apply/getApplyTypeName",consumes = "application/json")
        Result getApplyTypeName (@RequestBody IamIdentApplySystemDto iamApplySystemDto);

        /**
         * 根据应用类型查询用用名称
         * @param identApplyTypeCodeDto
         * @param
         * @return
         */
        @PostMapping(value = "/iam/user/Apply/queryApplyTypeCode",consumes = "application/json")
        Result queryApplyTypeCode (@RequestBody IdentApplyTypeCodeDto identApplyTypeCodeDto);

        /**
         * 根据登录名查询管理员角色列表
         * @param identAdminRoleUserDto
         * @param
         * @return
         */
        @PostMapping(value = "/iam/user/role/queryAdminRoleByUser",consumes = "application/json")
        Result<List<IdentAdminUserRoleVo>> queryAdminRoleByUser (@RequestBody IdentAdminRoleUserDto identAdminRoleUserDto) ;


        /**
         * 功能描述：账户中心——账号列表分页条件查询（普管）
         * @param iamQueryUserByOrgParam
         * @return PageInfo
         */
        @PostMapping(value = "/iam/user/info/queryAccountListRange")
        Result queryAccountListRange(IamQueryUserByOrgParam iamQueryUserByOrgParam);

        /**
         * 功能描述：查询管理员权限列表
         * param：adminRoleCode
         * param：companyCode
         * @return Result
         */
        @PostMapping("/iam/user/adminRole/queryAdminRole")
        Result<AdminRoleVo> queryAdminRole(@RequestParam("roleCode") String adminRoleCode, @RequestParam("companyCode") String companyCode) ;

}
